﻿using System;

namespace Program
{
    class Program
    {
        static void Main(string[] args)
        {
            int max;//最大值
            int min;//最小值
            int num;//输入的整数

            //输入数据，检测是否为整数
            Console.WriteLine("请输入一个整数（输入0结束）");
            while (!(int.TryParse(Console.ReadLine(), out num)))
            {
                Console.WriteLine("您输入的不是整数，请重新输入一个整数！");
            }
            max = min = num;


            //num = max = min = Convert.ToInt32(Console.ReadLine());
            while (num != 0)
            {
                //如果输入数大于当前最大值，进行替换
                //if (num > max)
                //{
                //    max = num;
                //}
                if(num > max)
                    max = num;
                //如果输入数小于当前最小值，进行替换
                //else if (num < min)
                //{
                //    min = num;
                //}
                if (num < min)
                    min = num;
                //Console.WriteLine("请输入一个整数（输入0结束）");
                //num = Convert.ToInt32(Console.ReadLine());
                //if (num == 0)
                //{
                //    Console.WriteLine("结束");
                //}
                Console.WriteLine("请继续输入：（输入0终止程序）");
                while (!(int.TryParse(Console.ReadLine(), out num)))
                {
                    Console.WriteLine("您输入的不是整数，请重新输入一个整数！");
                }

            Console.WriteLine("最大值：" + max + "最小值:" + min);
            //Console.WriteLine();

            int i, j;
                for (i = 1; i <= 9; i++)
                {
                    for (j = 1; j <= i; j++)
                    {
                        Console.Write("{0}*{1}={2,2} ", i, j, i * j);
                    }
                    Console.WriteLine();
                }
            }
        }
    }
}
